import requests
import json


headers = {
    "accept": "text/html,image/webp,ajax/ajax,*/*",
    "accept-language": "zh-CN,zh;q=0.9",
    "cache-control": "no-cache",
    "content-type": "application/json",
    "device-memory": "8",
    "downlink": "10",
    "dpr": "1",
    "ect": "4g",
    "origin": "https://www.amazon.com",
    "pragma": "no-cache",
    "priority": "u=1, i",
    "referer": "https://www.amazon.com/s?k=watches&language=zh&_encoding=UTF8&content-id=amzn1.sym.db94be39-53f1-4c79-89b2-88aa81be709e&pd_rd_r=6cf99381-d2e6-4220-bdef-c5ddb4d32cc3&pd_rd_w=axQdG&pd_rd_wg=JIcE9&pf_rd_p=db94be39-53f1-4c79-89b2-88aa81be709e&pf_rd_r=8CXQVR0MTVZS7FS556W5&ref=pd_hp_d_btf_unk",
    "rtt": "200",
    "sec-ch-device-memory": "8",
    "sec-ch-dpr": "1",
    "sec-ch-ua": "\"Chromium\";v=\"130\", \"Google Chrome\";v=\"130\", \"Not?A_Brand\";v=\"99\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\"",
    "sec-ch-ua-platform-version": "\"7.0.0\"",
    "sec-ch-viewport-width": "1331",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-origin",
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",
    "viewport-width": "1331",
    "x-amazon-rush-fingerprints": "AmazonRushAssetLoader:1202F8AA9B9E3A62A246BF3FA42812770110C222|AmazonRushFramework:EC446FBE6D4385B7660F56A844F4D427DE175225|AmazonRushRouter:15D9B6124DC03EC360DD1DF8362BD9C8156D4486",
    "x-amazon-s-fallback-url;": "",
    "x-amazon-s-mismatch-behavior": "ABANDON",
    "x-amazon-s-swrs-version": "E7ED3582B29E6429DDC4C4599660EABF,D41D8CD98F00B204E9800998ECF8427E",
    "x-requested-with": "XMLHttpRequest"
}
cookies = {
    "session-id": "141-9585955-2831708",
    "session-id-time": "2082787201l",
    "i18n-prefs": "USD",
    "lc-main": "zh_CN",
    "sp-cdn": "\"L5Z9:CN\"",
    "skin": "noskin",
    "ubid-main": "132-6349621-4696547",
    "session-token": "3gqGfKtt4HQ4AznZB1U8sLnbHTUxYY3w488o91pYZPyCmuu1DndIb5ZSB5CALqxGPzU9m7QDCEM315ny1TVOu599ewj/ohBKAk5igXJQHwhDOiLz0Sv7dp5FlsPp+pOwuZVXTsxORwo27peJFDqhdevj9E55VyI3iiTU8MleV0xiwwyeSg94Z+X9uCW7OekyFV/9sSySOo663hHOgkBwogiSmOLVeQC431b5UXF4vecm66yxG5CDlSY7sTYsROPqfsJDe3jZjqH05ab/tReTsqiF+cV6KqACBSAGwPwIScKBFdS0BCaa3PTFZz0g/Gmv1CS/PhNJqJH4njvfMENfmCijtt5m+efy",
    "csm-hit": "tb:8CXQVR0MTVZS7FS556W5+s-DQR3YPGF54B8PNGJS1D2|1732006657095&t:1732006657095&adb:adblk_yes"
}
url = "https://www.amazon.com/s/query"
params = {
    "_encoding": "UTF8",
    "content-id": "amzn1.sym.db94be39-53f1-4c79-89b2-88aa81be709e",
    "k": "watches",
    "language": "zh",
    "page": "2",
    "pd_rd_r": "6cf99381-d2e6-4220-bdef-c5ddb4d32cc3",
    "pd_rd_w": "axQdG",
    "pd_rd_wg": "JIcE9",
    "pf_rd_p": "db94be39-53f1-4c79-89b2-88aa81be709e",
    "pf_rd_r": "8CXQVR0MTVZS7FS556W5",
    "qid": "1732007241",
    "ref": "sr_pg_1"
}
data = {
    "page-content-type": "atf",
    "prefetch-type": "rq",
    "customer-action": "pagination"
}
data = json.dumps(data, separators=(',', ':'))
response = requests.post(url, headers=headers, cookies=cookies, params=params, data=data)

print(response.text)
print(response)
res = response.text
result = res.split("&&&")
print(result)